/*
 * Copyright(c) YouYuan 2018.
 * https://gitee.com/you-yuan
 */

package com.yuan.ocr.demo;

import com.yuan.ocr.kit.HtmlImgOCR;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.util.List;

/**
 * @author YouYuan
 * @version 1.0
 * @Email xiyousuiyuan@163.com
 * @Date 2018/10/28 18:58
 */
public class HtmlImgOcrDemo {

    public static void main(String[] args) throws Exception {
        String filePath = "D:/Test/Develop/Yuan-OCR-Kit/Html/社会心理学/";
        String fileName = "社会心理学-笔记本.html";
        List<String> list = HtmlImgOCR.doOcr(filePath + fileName, "Utf-8", filePath);
        FileWriter fileWriter = new FileWriter(new File(filePath + "导出笔记.txt"), true);
        BufferedWriter writer = new BufferedWriter(fileWriter);
        for (int i = 0; i < list.size(); i++) {
            String text = list.get(i);
            System.out.println(text);
            writer.write(text);
            writer.newLine();
        }
        writer.flush();
        fileWriter.close();
        writer.close();
    }
}
